package com.ojoin.ojoin.eb_spider.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ojoin.ojoin.eb_spider.domain.AlipayAccount;
import com.ojoin.ojoin.eb_spider.domain.AlipayRelations;
import com.ojoin.ojoin.eb_spider.domain.BankCardCheck;
import com.ojoin.ojoin.eb_spider.service.AlipayAccountService;
import com.ojoin.ojoin.eb_spider.service.AlipayBankCardService;
import com.ojoin.ojoin.eb_spider.service.AlipayRelationsService;
import com.ojoin.ojoin.eb_spider.service.CaiNaioInventoryService;
import com.ojoin.trade.supplyloan_core.web.domain.TbSlPlatformUser;

@Service
public class AlipayRelationsServiceImpl implements AlipayRelationsService {

	@Autowired
	private AlipayAccountService alipayAccountService;

	@Autowired
	private AlipayBankCardService alipayBankCardService;

	@Autowired
	private CaiNaioInventoryService caiNaioInventoryService;

	@Override
	public AlipayRelations getAlipayRelations(TbSlPlatformUser user) throws Exception {
		AlipayRelations ar = new AlipayRelations();

		List<AlipayAccount> re = alipayAccountService.getAlipayAccounts(user);
		List<BankCardCheck> ab = alipayBankCardService.getAlipayBankCard(user);

		AlipayAccount main = re.get(0);

		ar.setAlipayAccountMain(main);
		ar.setAlipayBankCardMain(ab.get(0));

		ar.setBankCards(ab);
		ar.setRelations(re);
		


		return ar;
	}

}
